Welcome to Telma's Library - Plotting

This Jupyter notebook aims at showing some basic plotting function of Telma.

image.png

Plotting functions are located in OneLife or MultiplesLives classes.

Besides the "classic static" manner of plotting in life actuarial science. Telma permits plotting charts interactively.

Let's have a look at the following examples.

Using G20 dataset.

Note: this database refers to the G20 countries and that was downloaded from kaggle. Click the following link to obtain it. Dataset lifeTables

Usa_male and Usa_females cohorts.


Plotting using OneLife and MultipleLives (statically).


OneLife

It will be possible to graph either from a cohort function or several.

Example with one cohort: Usa_Male.

Invoking OneLife, lifeplot method has as parameters:

Hump mortality of usa_male

MultipleLives

The question: do I want to plot more cohorts?

Follow the same steps as OneLife ().lifeplot but with:


Example: usa_male, usa_female and a "model".

The model will be specified as:
$$F(X) = 1- e^{-0.0001x^{e^{x/115}}}$$$$S(X) = 1-F(X)= e^{-0.0001x^{e^{x/115}}}$$

$Clearly:$

\begin{equation} 1- S(X) = F(X)= \begin{cases} 0, & \text{if}\ x < 0 \\ 1 - e^{-0.0001x^{e^{x/115}}}, & \text{if}\ 0 \le X < 115\\ 1, & \text{if}\ x \geq\ 115 \end{cases} \end{equation} $F(115) = 1$ if $1 - e^{(-0.0001 \cdot 115^{e^{(115/115)}})}.$ Consequently: $S(115) = 0$.

NOTE: Dummy model has no mortality hump around 20s


Plotting using OneLife and MultipleLives (dinamically).


Now The question is: do I want to see the graph in a dynamic and interactive way?
I want to see it in interactive mode, for more cohorts, and tell me the life expectancy? Example, with the French:

Passing the mouse on it you can observe onto the graph:

Note: From here the charts are interactive. It is requested that you pass the mouse onto it to see in detail.

Mortality hump: usa_male, france_female and the model

If the length of $l(x)$ is different from $l(y)$ consider passing the vector with less "len" in model parameter. (It might be not necessary)